Skip to content

fix: strip fenced code language headers with CRLF line endings - #1198

Open
DZH166 wants to merge 1 commit into
Pythagora-io:mainfrom
DZH166:codex/parse-crlf-code-fences
Open

DZH166 wants to merge 1 commit into
Pythagora-io:mainfrom
DZH166:codex/parse-crlf-code-fences

Conversation

@DZH166

@DZH166 DZH166 commented Nov 1, 2026

Copy link
Copy Markdown

What changed

Allow CRLF as well as LF after fenced-code language headers in MultiCodeBlockParser and DescriptiveCodeBlockParser. Previously a json\r\n header was retained as content, causing JSONParser to reject an otherwise valid fenced JSON response. The descriptive parser could likewise put python into generated source files.

Only the header line-ending match changes; line endings within the extracted content are preserved.

Verification

  • python -m pytest tests/llm/test_parser.py --no-cov -o addopts='' -ra: 45 passed (existing Pydantic deprecation warnings).
  • Four CRLF cases failed before the fix; their LF counterparts passed. Regressions exercise the real single-block, multi-block, descriptive and JSON parsers without mocks.
  • Ruff 0.3.5 check/format and git diff --check passed for both changed files.

No provider calls or full application suite were run.

Prepared with AI assistance; the checks above were run locally.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants